//
//  LZRestaurantFiltersView.m
//  LzzizDemo
//
//  Created by xbnzd on 16/10/31.
//  Copyright © 2016年 xbnzd. All rights reserved.
//

#import "LZRestaurantFiltersView.h"
#import "LZRestaurantFilterCell.h"
#import "LZRestaurantFilterHeaderView.h"
#import "LZRestaurantFilterFooterView.h"
#import "LZRestaurantFiltersTextFiledCell.h"
#import "LZRestaurantFilterFlowLayout.h"
#import "LZPublicKeywordModel.h"
#import "LZCuisineModel.h"
#import "LZHotAreaModel.h"
#import "Masonry.h"
#import "LZFilterViewPresenter.h"
#import "LZDateFormatterManager.h"
#import <AVFoundation/AVFoundation.h>


static NSString *headerStr = @"filterHeader";
static NSString *footerStr = @"filterFooter";
static NSString *cellNormalStr   = @"filterCell";
static NSString *cellTextFiledStr = @"textFiledCell";
static int datePickerBgViewHeight = 220;
static int datePickerHeight = 190;
static CGFloat selfMaxWidth = 285.0;

typedef NS_ENUM(NSInteger, TextFiledTag) {
    kCost_Min   = 100,
    kCost_Max   = 101,
    kBegin_Time = 102,
    kEnd_Time   = 103
};

@interface LZRestaurantFiltersView()<UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout,UIGestureRecognizerDelegate,LZRestaurantsFilterTextFiledCellDelegate,LZRestaurantFilterFooterViewDelegate>

@property (nonatomic, strong) UICollectionView *collectionView;
@property (nonatomic, strong) UIView *collectionViewBGView;
@property (nonatomic, strong) UIDatePicker *datePicker;
@property (nonatomic, strong) UIView *datePickerBgView;
@property (nonatomic, strong) UIButton *pickerConfirmBtn;
@property (nonatomic, strong) UIButton *pickerCancelBtn;
@property (nonatomic, strong) UIButton *confirmBtn;
@property (nonatomic, strong) UITextField *textFiledTemp;
@property (nonatomic, strong) NSString *confirmDateStrTemp;   //确认后的时间

@property (nonatomic, strong) NSMutableArray *distanceDataArr;          //距离范围数据
@property (nonatomic, strong) NSString       *distanceSelectedStr;      //选中的距离值
@property (nonatomic, strong) NSMutableArray *hotAreasSelectedArr;  //热门商区选中结果,多选,用数组存储
@property (nonatomic, strong) NSMutableArray *cuisineSelectedArr;       //菜系的选中结果
@property (nonatomic, strong) NSString       *costForPersionMinPriceStr;//填写完的人均最低消费
@property (nonatomic, strong) NSString       *costForPersionMaxPriceStr;//填写后的人均最高消费
@property (nonatomic, strong) NSString       *publicBeginTimeStr;       //客户选填开始时间
@property (nonatomic, strong) NSString       *publicEndSTimetr;         //客户选填结束时间
@property (nonatomic, strong) NSMutableArray        *discountsDataArr;            //优惠数据
@property (nonatomic, strong) NSMutableArray *discountsSelectedArr;        //用户选择的优惠
@property (nonatomic, strong) NSMutableArray        *sortDataArr;              //排序数据
@property (nonatomic, strong) NSString       *sortSelectedStr;          //排序选择结果
@property (nonatomic, strong) NSMutableArray *othersDataArr;            //其他选项
@property (nonatomic, strong) NSString       *othersSelectedStr;        //其他选项选择结果

@property (nonatomic, strong) NSArray        *sectionTitleArr;          //section title arr.默认值.

@property (nonatomic, assign) CGFloat collectionViewWith;

@property (nonatomic, strong) NSMutableDictionary *historyDic;   //存储每一次点击确定时的筛选记录

@end

@implementation LZRestaurantFiltersView

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.collectionViewWith = 305;
        [self initUI];
    }
    self.backgroundColor = [[UIColor blackColor]colorWithAlphaComponent:0.0];
    self.hidden = YES;
    return self;
}


#pragma mark -
#pragma mark private action
/**
 datePicker 滚动后调用的方法
 */
- (void)datePickerValueChangeAction
{
    NSDate *select = [self.datePicker date];
    _confirmDateStrTemp =  [[LZDateFormatterManager shareInstance] stringFromCustomFormat:@"dd-MM-yyyy" andDate:select];
}


/**
 检查平均消费是否符合要求, 如果最小值大于最大值,需要反转

 */
- (BOOL)checkCostNeedReverse
{
    int minCost = [_costForPersionMinPriceStr intValue];
    int maxCost = [_costForPersionMaxPriceStr intValue];
    if (minCost > maxCost) {
        NSString *temp = _costForPersionMaxPriceStr;
        _costForPersionMaxPriceStr = _costForPersionMinPriceStr;
        _costForPersionMinPriceStr = temp;
        
        return YES;
    }
    
    return NO;
}


/**
 检查发布起始时间,如果开始时间大于结束时间,反转
 */
- (BOOL)checkPublicTimeNeedReverse
{
    NSDate *beginDate=[[LZDateFormatterManager shareInstance] dateFromCustomFormat:@"dd-MM-yyyy" andDate:_publicBeginTimeStr];
    NSDate *endDate =[[LZDateFormatterManager shareInstance] dateFromCustomFormat:@"dd-MM-yyyy" andDate:_publicEndSTimetr];
    
    NSComparisonResult result = [beginDate compare:endDate];
    
    if (result == NSOrderedDescending) {
        NSString *temp = _publicBeginTimeStr;
        _publicBeginTimeStr = _publicEndSTimetr;
        _publicEndSTimetr = temp;
        
        return YES;
    }
    
    return NO;
    
}

/**
 确认时,配置参数

 @return <#return value description#>
 */
- (NSMutableDictionary *)configureParameter
{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc] init];
    
    //距离
    if (_distanceSelectedStr.length > 0) {
        NSString *str = [_distanceSelectedStr substringToIndex:_distanceSelectedStr.length - 1];
        [dic setObject:[NSNumber numberWithInt:[str intValue]] forKey:@"distance"];
    }
    
    //排序字段
    if (_sortSelectedStr.length > 0) {
        if ([_sortSelectedStr isEqualToString:LZLocalizedString(@"rating", nil)]) {
            [dic setObject:@[@{@"field" : @"averageScore",@"order" : @"desc"}] forKey:@"orders"];
        }else if ([_sortSelectedStr isEqualToString:LZLocalizedString(@"height_price", nil)]){
            [dic setObject:@[@{@"field" : @"averageConsumption",@"order" : @"desc"}] forKey:@"orders"];
        }else if ([_sortSelectedStr isEqualToString:LZLocalizedString(@"low_price", nil)]){
            [dic setObject:@[@{@"field" : @"averageConsumption",@"order" : @"asc"}] forKey:@"orders"];
        }else if ([_sortSelectedStr isEqualToString:LZLocalizedString(@"taste", nil)]){
            [dic setObject:@[@{@"field" : @"remarkCountTaste",@"order" : @"desc"}] forKey:@"orders"];
        }else if ([_sortSelectedStr isEqualToString:LZLocalizedString(@"atmosphere", nil)]){
            [dic setObject:@[@{@"field" : @"remarkCountEnv",@"order" : @"desc"}] forKey:@"orders"];
        }else if ([_sortSelectedStr isEqualToString:LZLocalizedString(@"service", nil)]){
            [dic setObject:@[@{@"field" : @"remarkCountService",@"order" : @"desc"}] forKey:@"orders"];
        }
    }
    
    //优惠类型
    NSMutableArray *arr = [[NSMutableArray alloc] init];
    for (LZPublicKeywordModel *m in self.discountsSelectedArr) {
        [arr addObject:[NSNumber numberWithInt:m.mNumber]];
    }
    if (arr.count > 0) {
        [dic setObject:[arr copy] forKey:@"promotionByte"];
    }
    
    
    //平均消费范围
    if (_costForPersionMinPriceStr.length > 0) {
        [dic setObject:[NSNumber numberWithInt:[_costForPersionMinPriceStr intValue]] forKey:@"gtAverConsumption"];
    }
    
    if (_costForPersionMaxPriceStr.length > 0) {
        [dic setObject:[NSNumber numberWithInt:[_costForPersionMaxPriceStr intValue]] forKey:@"ltAverConsumption"];
    }
    
    //优惠时间段
    if (_publicBeginTimeStr.length > 0) {
        NSTimeInterval timeTemp = [self getTimeIntervalWihtTimeStr:[NSString stringWithFormat:@"%@ 00:00:00",_publicBeginTimeStr]];
        [dic setObject:[NSNumber numberWithDouble:timeTemp] forKey:@"gtPublishTime"];
    }
    
    if (_publicEndSTimetr.length > 0) {
        NSTimeInterval timeTemp = [self getTimeIntervalWihtTimeStr:[NSString stringWithFormat:@"%@ 23:59:59",_publicEndSTimetr]];
        [dic setObject:[NSNumber numberWithDouble:timeTemp] forKey:@"ltPublishTime"];
    }
    
    //菜系
    if (self.cuisineSelectedArr.count > 0) {
        NSString *cookName = @"";
        for (int i = 0; i < self.cuisineSelectedArr.count; i ++) {
            LZCuisineModel *m = self.cuisineSelectedArr[i];
            if (i == self.cuisineSelectedArr.count - 1) {
                cookName = [cookName stringByAppendingString:[NSString stringWithFormat:@"%@",m.cuisineID]];
            }else{
                cookName = [cookName stringByAppendingString:[NSString stringWithFormat:@"%@,",m.cuisineID]];
            }
            
        }
        [dic setObject:cookName forKey:@"cookingStyle"];
    }
    
    //热门商区
    if (self.hotAreasSelectedArr.count > 0) {
        NSString *hotID = @"";
        for (int i = 0; i < self.hotAreasSelectedArr.count; i ++) {
            LZHotAreaModel *m = self.hotAreasSelectedArr[i];
            if (i == self.hotAreasSelectedArr.count - 1) {
                hotID = [hotID stringByAppendingString:[NSString stringWithFormat:@"%@",m.hotAreaID]];
            }else{
               hotID = [hotID stringByAppendingString:[NSString stringWithFormat:@"%@,",m.hotAreaID]];
            }
            
        }
        [dic setObject:hotID forKey:@"areaId"];

    }
    
    //其他选项
    if (_othersSelectedStr.length > 0) {
        [dic setObject:[NSNumber numberWithInt:1] forKey:@"isOpening"];
    }
    
    return dic;
}

/**
 移除视图,并且还原上一次的值
 */
- (void)removeSelfAndRestoreLastData
{
    if (self.historyDic.count == 0) {
        [self clearBtnAction];
    }else{
        NSArray *keyArr = [self.historyDic allKeys];
        //还原 距离选项 上次的值
        if ([keyArr containsObject:@"distance"]) {
            _distanceSelectedStr = [LZFilterViewPresenter restoreTheDistanceDataWithKeyword:self.historyDic[@"distance"] dataSource:self.distanceDataArr];
        }else{
            _distanceSelectedStr = nil;
            for (LZPublicKeywordModel *m in self.distanceDataArr) {
                m.selected = NO;
            }
        }
        
        //还原 排序字段 上次的值
        if ([keyArr containsObject:@"orders"]) {
            _sortSelectedStr = [LZFilterViewPresenter restoreTheSortDataWithKeywordDic:self.historyDic[@"orders"][0] dataSource:self.sortDataArr];
        }else{
            _sortSelectedStr = nil;
            for (LZPublicKeywordModel *m in self.sortDataArr) {
                m.selected = NO;
            }
        }
        
        //还原 优惠类型 上次的值
        if ([keyArr containsObject:@"promotionByte"]) {
            self.discountsSelectedArr = [LZFilterViewPresenter restoreTheDiscountsDataWithDiscountNumberIDArr:self.historyDic[@"promotionByte"] DataSource:self.discountsDataArr];
        }else{
            if (self.discountsSelectedArr.count > 0) {
                [self.discountsSelectedArr removeAllObjects];
                for (LZPublicKeywordModel *m in self.discountsDataArr) {
                    m.selected = NO;
                }
            }
        }
        
        //还原平均消费范围
        if ([keyArr containsObject:@"gtAverConsumption"]) {
            _costForPersionMinPriceStr = [NSString stringWithFormat:@"%@",self.historyDic[@"gtAverConsumption"]];
        }else{
            _costForPersionMinPriceStr = nil;
        }
        if ([keyArr containsObject:@"ltAverConsumption"]) {
            _costForPersionMaxPriceStr = [NSString stringWithFormat:@"%@",self.historyDic[@"ltAverConsumption"]];
        }else{
            _costForPersionMaxPriceStr = nil;
        }
        
        //还原优惠时间段
        if ([keyArr containsObject:@"gtPublishTime"]) {
            _publicBeginTimeStr = [self getTimeStrWithTimeInterval:[self.historyDic[@"gtPublishTime"] doubleValue]];
        }else{
            _publicBeginTimeStr = nil;
        }
        if ([keyArr containsObject:@"ltPublishTime"]) {
            _publicEndSTimetr = [self getTimeStrWithTimeInterval:[self.historyDic[@"ltPublishTime"] doubleValue]];
        }else{
            _publicEndSTimetr = nil;
        }
        
        //还原菜系
        if ([keyArr containsObject:@"cookingStyle"]) {
            self.cuisineSelectedArr = [LZFilterViewPresenter restoreTheCuisineDataWithCuisineIDStr:self.historyDic[@"cookingStyle"] DataSource:self.cuisineDataArr];
        }else{
            if (self.cuisineSelectedArr.count > 0) {
                [self.cuisineSelectedArr removeAllObjects];
                for (LZCuisineModel *m in self.cuisineDataArr) {
                    m.selected = NO;
                }
            }
        }
        
        //还原热门商区
        if ([keyArr containsObject:@"areaId"]) {
            self.hotAreasSelectedArr = [LZFilterViewPresenter restoreTheHotAreaDataWithHotAreaIDStr:self.historyDic[@"areaId"] DataSource:self.hotAreasDataArr];
        }else{
            if (self.hotAreasSelectedArr.count > 0) {
                [self.hotAreasSelectedArr removeAllObjects];
                for (LZHotAreaModel *m in self.hotAreasDataArr) {
                    m.selected = NO;
                }
            }
        }
        
        //还原其他选项
        if ([keyArr containsObject:@"isOpening"]) {
            _othersSelectedStr = [LZFilterViewPresenter restoreTheOtherDataWithdataSource:self.othersDataArr];
        }else{
            _othersSelectedStr = nil;
            for (LZPublicKeywordModel *m in self.othersDataArr) {
                m.selected = NO;
            }
        }
        [self.collectionView reloadData];
    }
    
    [self remvoeSelfAction];
}


/**
 动画移除自己
 */
- (void)remvoeSelfAction
{
    [self removeDatePickerViewAnimation];
    [[UIApplication sharedApplication].keyWindow endEditing:YES];
    [self.collectionViewBGView updateConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(SCREEN_WIDTH);
    }];

    [UIView animateWithDuration:0.2 animations:^{
        
         [self layoutIfNeeded];
    } completion:^(BOOL finished) {
        
            [UIView animateWithDuration:0.1 animations:^{
                
                self.backgroundColor = [[UIColor blackColor]colorWithAlphaComponent:0.0];
            } completion:^(BOOL finished) {
                
                self.hidden = YES;
            }];
        
    }];
    

}


/**
 动画展现datePicker view
 */
- (void)showDatePickerViewAnimation
{
    [self.datePickerBgView updateConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(0);
        make.trailing.mas_equalTo(0);
        make.bottom.mas_equalTo(0);
        make.height.mas_equalTo(datePickerBgViewHeight);
    }];
    
    
   [UIView animateWithDuration:0.2 animations:^{
       
       [self layoutIfNeeded];
   } completion:^(BOOL finished) {
       NSIndexPath *p = [NSIndexPath indexPathForRow:0 inSection:3];
       [self.collectionView scrollToItemAtIndexPath:p atScrollPosition:UICollectionViewScrollPositionTop animated:YES];
   }];
}

- (void)removeDatePickerViewAnimation
{
    _confirmDateStrTemp = @"";
    [self.datePickerBgView updateConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(0);
        make.trailing.mas_equalTo(0);
        make.bottom.mas_equalTo(datePickerBgViewHeight);
        make.height.mas_equalTo(datePickerBgViewHeight);
    }];
   [UIView animateWithDuration:0.3 animations:^{
       [self layoutIfNeeded];
   } completion:^(BOOL finished) {
       
   }];
    
    
}

- (CGFloat)returnCellWidth:(NSString *)str
{
    CGFloat w = [str boundingRectWithSize:CGSizeMake(MAXFLOAT, 40) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:15]} context:nil].size.width;
    if (w + 26 > selfMaxWidth) {
        return selfMaxWidth;
    }
    return w + 26;
}

#pragma mark -
#pragma mark btn action ges event

/**
 点击空白处事件
 */
- (void)tapAction
{
    [self removeSelfAndRestoreLastData];
}


/**
 滑动空白处事件
 */
- (void)swipeAction
{
    [self removeSelfAndRestoreLastData];
}

/**
 取消时间选项按钮
 */
- (void)cancelPickerBtnAction
{
    [self removeDatePickerViewAnimation];
}


/**
 确认时间按钮
 */
- (void)confirmPickerBtnAction
{
    if (_confirmDateStrTemp.length == 0) {
        _confirmDateStrTemp =  [[LZDateFormatterManager shareInstance] stringFromCustomFormat:@"dd-MM-yyyy" andDate:[NSDate date]];

    }
    
    [CATransaction begin];
    [CATransaction setDisableActions:YES];
    _textFiledTemp.text = _confirmDateStrTemp;
    
    if (_textFiledTemp.tag == kBegin_Time) {
        _publicBeginTimeStr = _textFiledTemp.text;
    }else if (_textFiledTemp.tag == kEnd_Time){
        _publicEndSTimetr = _textFiledTemp.text;
    }
    
    [CATransaction commit];
    
    [self removeDatePickerViewAnimation];
}

/**
 清空筛选结果
 */
- (void)clearBtnAction
{
    //距离
    _distanceSelectedStr = @"";
    for (LZPublicKeywordModel *m in self.distanceDataArr) {
        m.selected = NO;
    }
    
    //排序
    _sortSelectedStr = @"";
    for (LZPublicKeywordModel *m in self.sortDataArr) {
        m.selected = NO;
    }
    
    //热门商区
    [self.hotAreasSelectedArr removeAllObjects];
    for (LZHotAreaModel *m in self.hotAreasDataArr) {
        m.selected = NO;
    }
    
    //菜系
    [self.cuisineSelectedArr removeAllObjects];
    for (LZCuisineModel *m in self.cuisineDataArr) {
        m.selected = NO;
    }
    
    //优惠条件
    [self.discountsSelectedArr removeAllObjects];
    for (LZPublicKeywordModel *m in self.discountsDataArr) {
        m.selected = NO;
    }
    
    //人均消费
    _costForPersionMaxPriceStr = nil;
    _costForPersionMinPriceStr = nil;
    
    //时间段
    _publicEndSTimetr = nil;
    _publicBeginTimeStr = nil;
    [self.datePicker setDate:[NSDate date] animated:NO];
    
    //其他
    _othersSelectedStr = nil;
    for (LZPublicKeywordModel *m in self.othersDataArr) {
        m.selected = NO;
    }
    
    //备份
//    [self.historyDic removeAllObjects];
    
    [self.collectionView reloadData];
}


/**
 确认筛选结果
 */
- (void)confirmBtnAction
{
    if (self.historyDic.count > 0) {
        [self.historyDic removeAllObjects];
    }
    BOOL cost = [self checkCostNeedReverse];
    BOOL pTime = [self checkPublicTimeNeedReverse];
    self.historyDic = [self configureParameter];
    if (self.filterViewDelegate && [self.filterViewDelegate respondsToSelector:@selector(returnTheFileterResult:)]) {
        [self.filterViewDelegate performSelector:@selector(returnTheFileterResult:) withObject:[self.historyDic copy]];
    }
    [self remvoeSelfAction];
    if (cost || pTime) {
        [self.collectionView reloadData];
    }
}




#pragma mark -
#pragma mark public method
/**
 动画展现自己
 */
- (void)showSelfAnimation
{
//    [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
    self.hidden = NO;
    self.backgroundColor = [[UIColor blackColor]colorWithAlphaComponent:0.4];
    
    [self.collectionViewBGView updateConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(SCREEN_WIDTH - self.collectionViewWith);
    }];
    
    [UIView animateWithDuration:0.2 animations:^{
        [self layoutIfNeeded];
    } completion:^(BOOL finished) {
        
    }];
    
    
}


/**
 清空筛选结果
 */
- (void)clearFilterResult
{
    [self clearBtnAction];
}

#pragma mark -
#pragma mark 单击 gestureRecognizer delegate
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
    CGPoint p = [gestureRecognizer locationInView:self];
    BOOL a = CGRectContainsPoint(self.collectionViewBGView.frame, p);
    if (a) {
        return NO;
    }
    
    return YES;
}

#pragma mark -
#pragma mark collectioncell  delegate datasource 协议 数据源
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
    return self.sectionTitleArr.count;
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    switch (section) {
        case 0:
            return self.distanceDataArr.count;
            break;
        case 1:
            return self.hotAreasDataArr.count;
            break;
        case 2:
            return self.cuisineDataArr.count;
            break;
        case 3:
            return 1;
            break;
        case 4:{
            if (_isForRestaurant) {
                return self.discountsDataArr.count;
            }
            return 1;
        }
            break;
        case 5:{
            if (_isForRestaurant) {
                return self.sortDataArr.count;
            }
            return self.discountsDataArr.count;
        }
            break;
        case 6:{
            if (_isForRestaurant) {
                return self.othersDataArr.count;
            }
            return self.sortDataArr.count;
        }
            break;
            
        default:
            break;
    }
    
    return 1;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    if (_isForRestaurant) {
        return [self loadCellForRestaurantWithCollectionView:collectionView cellIndexPath:indexPath];
    }
    
    return [self loadCellForVideoWithCollectionView:collectionView cellIndexPath:indexPath];
}


- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
    if (_isForRestaurant) {
        return [self returnCellSizeForRestaurantWithIndexPath:indexPath];
    }
    return [self returnCellSizeForVideoWithIndexPath:indexPath];
}

- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
{
    return UIEdgeInsetsMake(0, 10, 0, 10);
}

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section
{
    return CGSizeMake(200, 64);
}

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section
{
    if (section == self.sectionTitleArr.count - 1) {
        return CGSizeMake(200, 76);
    }
    return CGSizeMake(200, 0);
}

- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section
{
    return 19.0;
}

- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section
{
    return 14.0;
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    if (_isForRestaurant) {
        [self didSelectedItemForRestaurantWithIndexPath:indexPath];
    }else{
        [self didSelectedItemForVideoWithIndexPath:indexPath];
    }
    
    [UIView performWithoutAnimation:^{
        NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:indexPath.section];
        [self.collectionView reloadSections:indexSet];
    }];
    

}

- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
{
    if ([kind isEqualToString:UICollectionElementKindSectionHeader]) {
        LZRestaurantFilterHeaderView *headerView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:headerStr forIndexPath:indexPath];
        
        NSString *t = self.sectionTitleArr[indexPath.section];
        headerView.headerLabel.text = t;
        headerView.backgroundColor = [UIColor whiteColor];
        return headerView;
    }
    
    if ([kind isEqualToString:UICollectionElementKindSectionFooter] && indexPath.section == self.sectionTitleArr.count - 1) {
        LZRestaurantFilterFooterView *footView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:footerStr forIndexPath:indexPath];
        footView.footViewDelegate = self;
        footView.backgroundColor = [UIColor whiteColor];
        
        return footView;
    }
    
    return nil;
}

#pragma mark - foot 协议方法
- (void)footViewClearBtnAction
{
    [self clearBtnAction];
}

#pragma mark -
#pragma mark cell协议方法 .针对视频, 餐厅区分
/**
 针对视频筛选的cell布局

 @param collectionView <#collectionView description#>
 @param indexPath <#indexPath description#>
 @return <#return value description#>
 */
- (UICollectionViewCell *)loadCellForVideoWithCollectionView:(UICollectionView *)collectionView cellIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section != 3 && indexPath.section != 4) {
        LZRestaurantFilterCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellNormalStr forIndexPath:indexPath];
        NSString *str = @"";
        switch (indexPath.section) {
            case 0:{
                LZPublicKeywordModel *m = self.distanceDataArr[indexPath.row];
                str = m.name;
                [cell showSelectedStateForRadio:m.selected];
            }
                
                break;
            case 1:{
                LZHotAreaModel *m = self.hotAreasDataArr[indexPath.row];
                str = m.name;
                [cell showSelectedStateForMultiSelect:m.selected];
            }
                
                break;
            case 2:{
                LZCuisineModel *m = self.cuisineDataArr[indexPath.row];
                str = m.name;
                [cell showSelectedStateForMultiSelect:m.selected];
            }
                
                break;
            case 5:{
                LZPublicKeywordModel *m = self.discountsDataArr[indexPath.row];
                str = m.name;
                [cell showSelectedStateForMultiSelect:m.selected];
            }
                break;
            case 6:{
                LZPublicKeywordModel *m = self.sortDataArr[indexPath.row];
                str = m.name;
                [cell showSelectedStateForRadio:m.selected];
            }
                break;
                
            default:
                break;
        }
        
        [cell loadData:str];
        
        return cell;
        
    }else{
        LZRestaurantFiltersTextFiledCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellTextFiledStr forIndexPath:indexPath];
        if (indexPath.section == 3) {
            cell.isForDatePicker = NO;
            cell.textFiledCellDelegate = self;
            cell.LeftMinTextFiled.tag = kCost_Min;
            cell.RightMaxTextFiled.tag = kCost_Max;
            [cell setLeftTextFiledPlaceHolder:LZLocalizedString(@"set_lowest_price", nil) RightTextFiledPlaceHolder:LZLocalizedString(@"set_highest_price", nil)];
            if (_costForPersionMinPriceStr.length > 0) {
                [cell loadDataLeft:_costForPersionMinPriceStr];
            }
            
            if (_costForPersionMaxPriceStr.length > 0) {
                [cell loadDataRight:_costForPersionMaxPriceStr];
            }
            
            
        }else if (indexPath.section == 4){
            cell.isForDatePicker = YES;
            cell.textFiledCellDelegate = self;
            cell.LeftMinTextFiled.tag = kBegin_Time;
            cell.RightMaxTextFiled.tag = kEnd_Time;
            [cell setLeftTextFiledPlaceHolder:LZLocalizedString(@"from", nil) RightTextFiledPlaceHolder:LZLocalizedString(@"to", nil)];
            
            if (_publicBeginTimeStr.length > 0) {
                [cell loadDataLeft:_publicBeginTimeStr];
            }
            
            if (_publicEndSTimetr.length > 0) {
                [cell loadDataRight:_publicEndSTimetr];
            }
        }
        return cell;
    }
    
    return nil;

}

/**
 针对餐厅筛选的cell布局
 
 @param collectionView <#collectionView description#>
 @param indexPath <#indexPath description#>
 @return <#return value description#>
 */
- (UICollectionViewCell *)loadCellForRestaurantWithCollectionView:(UICollectionView *)collectionView cellIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section != 3) {
        LZRestaurantFilterCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellNormalStr forIndexPath:indexPath];
        NSString *str = @"";
        switch (indexPath.section) {
            case 0:{
                LZPublicKeywordModel *m = self.distanceDataArr[indexPath.row];
                str = m.name;
                [cell showSelectedStateForRadio:m.selected];
            }
                
                break;
            case 1:{
                LZHotAreaModel *m = self.hotAreasDataArr[indexPath.row];
                str = m.name;
                [cell showSelectedStateForMultiSelect:m.selected];
            }
                
                break;
            case 2:{
                LZCuisineModel *m = self.cuisineDataArr[indexPath.row];
                str = m.name;
                [cell showSelectedStateForMultiSelect:m.selected];
            }
                
                break;
            case 4:{
                LZPublicKeywordModel *m = self.discountsDataArr[indexPath.row];
                str = m.name;
                [cell showSelectedStateForMultiSelect:m.selected];
            }
                
                break;
            case 5:{
                LZPublicKeywordModel *m = self.sortDataArr[indexPath.row];
                str = m.name;
                [cell showSelectedStateForRadio:m.selected];
            }
                break;
            case 6:{
                LZPublicKeywordModel *m = self.othersDataArr[indexPath.row];
                str = m.name;
                [cell showSelectedStateForRadio:m.selected];
            }
                break;
                
            default:
                break;
        }
        
        [cell loadData:str];
        
        return cell;
        
    }else{
        LZRestaurantFiltersTextFiledCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellTextFiledStr forIndexPath:indexPath];
            cell.isForDatePicker = NO;
            cell.textFiledCellDelegate = self;
            cell.LeftMinTextFiled.tag = kCost_Min;
            cell.RightMaxTextFiled.tag = kCost_Max;
            [cell setLeftTextFiledPlaceHolder:LZLocalizedString(@"set_lowest_price", nil) RightTextFiledPlaceHolder:LZLocalizedString(@"set_highest_price", nil)];
            if (_costForPersionMinPriceStr.length > 0) {
                [cell loadDataLeft:_costForPersionMinPriceStr];
            }
            
            if (_costForPersionMaxPriceStr.length > 0) {
                [cell loadDataRight:_costForPersionMaxPriceStr];
            }
            
            
                return cell;
    }
    
    return nil;
    
}


/**
 返回视频筛选对应的cell size

 @param indexPath <#indexPath description#>
 @return <#return value description#>
 */
- (CGSize)returnCellSizeForVideoWithIndexPath:(NSIndexPath *)indexPath
{
    CGFloat w = 0.0;
    if (indexPath.section != 3 && indexPath.section != 4) {
        NSString *str = @"";
        switch (indexPath.section) {
            case 0:{
                LZPublicKeywordModel *m = self.distanceDataArr[indexPath.row];
                str = m.name;
            }
                
                break;
            case 1:{
                LZHotAreaModel *m = self.hotAreasDataArr[indexPath.row];
                str = m.name;
            }
                
                break;
            case 2:{
                LZCuisineModel *m = self.cuisineDataArr[indexPath.row];
                str = m.name;
            }
                
                break;
            case 5:{
                LZPublicKeywordModel *m = self.discountsDataArr[indexPath.row];
                str = m.name;
            }
                break;
            case 6:{
                LZPublicKeywordModel *m = self.sortDataArr[indexPath.row];
                str = m.name;
            }
                break;
                
            default:
                break;
        }
        
        
        w = [self returnCellWidth:str];
    }else{
        w =  selfMaxWidth;
    }
    
    return CGSizeMake(w, 36.5);

}

/**
 返回餐厅筛选对应的cell size
 
 @param indexPath <#indexPath description#>
 @return <#return value description#>
 */
- (CGSize)returnCellSizeForRestaurantWithIndexPath:(NSIndexPath *)indexPath
{
    CGFloat w = 0.0;
    if (indexPath.section != 3) {
        NSString *str = @"";
        switch (indexPath.section) {
            case 0:{
                LZPublicKeywordModel *m = self.distanceDataArr[indexPath.row];
                str = m.name;
            }
                
                break;
            case 1:{
                LZHotAreaModel *m = self.hotAreasDataArr[indexPath.row];
                str = m.name;
            }
                
                break;
            case 2:{
                LZCuisineModel *m = self.cuisineDataArr[indexPath.row];
                str = m.name;
            }
                
                break;
            case 4:{
                LZPublicKeywordModel *m = self.discountsDataArr[indexPath.row];
                str = m.name;
            }
                break;
            case 5:{
                LZPublicKeywordModel *m = self.sortDataArr[indexPath.row];
                str = m.name;
            }
                break;
            case 6:{
                LZPublicKeywordModel *m = self.othersDataArr[indexPath.row];
                str = m.name;
            }
                break;
                
            default:
                break;
        }
        
        
        w = [self returnCellWidth:str];
    }else{
        w =  285;
    }
    
    return CGSizeMake(w, 36.5);
    
}


/**
 针对视频 筛选 选择后的处理

 @param indexPath <#indexPath description#>
 */
- (void)didSelectedItemForVideoWithIndexPath:(NSIndexPath *)indexPath
{
    switch (indexPath.section) {
        case 0:{
            LZPublicKeywordModel *m = self.distanceDataArr[indexPath.row];
            _distanceSelectedStr = [LZFilterViewPresenter operationRadioDataWithKeyword:_distanceSelectedStr newSelectedModel:m dataSource:self.distanceDataArr];
        }
            
            break;
        case 1:{
            LZHotAreaModel *m = self.hotAreasDataArr[indexPath.row];
            [LZFilterViewPresenter operationMultiSelectDataWithModel:m selectedArr:self.hotAreasSelectedArr];
        }
            
            break;
        case 2:{
            LZCuisineModel *m = self.cuisineDataArr[indexPath.row];
            [LZFilterViewPresenter operationMultiSelectDataWithModel:m selectedArr:self.cuisineSelectedArr];
        }
            
            break;
        case 5:{
            LZPublicKeywordModel *m = self.discountsDataArr[indexPath.row];
            [LZFilterViewPresenter operationMultiSelectDataWithModel:m selectedArr:self.discountsSelectedArr];
        }
            break;
        case 6:{
            LZPublicKeywordModel *m = self.sortDataArr[indexPath.row];
            _sortSelectedStr = [LZFilterViewPresenter operationRadioDataWithKeyword:_sortSelectedStr newSelectedModel:m dataSource:self.sortDataArr];
        }
            break;
            
        default:
            break;
    }

}


/**
 针对 餐厅筛选 选择后的处理

 @param indexPath <#indexPath description#>
 */
- (void)didSelectedItemForRestaurantWithIndexPath:(NSIndexPath *)indexPath
{
    switch (indexPath.section) {
        case 0:{
            LZPublicKeywordModel *m = self.distanceDataArr[indexPath.row];
            _distanceSelectedStr = [LZFilterViewPresenter operationRadioDataWithKeyword:_distanceSelectedStr newSelectedModel:m dataSource:self.distanceDataArr];
        }
            
            break;
        case 1:{
            LZHotAreaModel *m = self.hotAreasDataArr[indexPath.row];
            [LZFilterViewPresenter operationMultiSelectDataWithModel:m selectedArr:self.hotAreasSelectedArr];
        }
            
            break;
        case 2:{
            LZCuisineModel *m = self.cuisineDataArr[indexPath.row];
            [LZFilterViewPresenter operationMultiSelectDataWithModel:m selectedArr:self.cuisineSelectedArr];
        }
            
            break;
        case 4:{
            LZPublicKeywordModel *m = self.discountsDataArr[indexPath.row];
            [LZFilterViewPresenter operationMultiSelectDataWithModel:m selectedArr:self.discountsSelectedArr];
        }
            
            break;
        case 5:{
            LZPublicKeywordModel *m = self.sortDataArr[indexPath.row];
             _sortSelectedStr = [LZFilterViewPresenter operationRadioDataWithKeyword:_sortSelectedStr newSelectedModel:m dataSource:self.sortDataArr];
        }
            break;
        case 6:{
            LZPublicKeywordModel *m = self.othersDataArr[indexPath.row];
           _othersSelectedStr = [LZFilterViewPresenter operationRadioDataWithKeyword:_othersSelectedStr newSelectedModel:m dataSource:self.othersDataArr];
        }
            break;
            
        default:
            break;
    }

}


#pragma mark -
#pragma mark textfiledcell delegate 时间输入框cell协议

/**
 弹出时间选择器

 @param textFiled <#textFiled description#>
 */
- (void)ClickForDatePickerWithTextFiled:(UITextField *)textFiled
{
    [[UIApplication sharedApplication].keyWindow endEditing:YES];
    _textFiledTemp = textFiled;
    [self showDatePickerViewAnimation];
    
    if (textFiled.text.length>0) {
        NSDate *date = [[LZDateFormatterManager shareInstance] dateFromCustomFormat:@"dd-MM-yyyy" andDate:textFiled.text];
        [self.datePicker setDate:date];
    }
    else {
        [self.datePicker setDate:[NSDate date]];
    }
    
    _confirmDateStrTemp = textFiled.text;
}


/**
 cell中textfield编辑完毕后调用返回相应的值

 @param textFiled <#textFiled description#>
 */
- (void)textFiledEditEnd:(UITextField *)textFiled
{
    if (textFiled.tag == kCost_Min) {
        _costForPersionMinPriceStr = textFiled.text;
    }else if (textFiled.tag == kCost_Max){
        _costForPersionMaxPriceStr = textFiled.text;
    }
}

#pragma mark -
#pragma mark time 操作

/**
 根据选择的时间返回相应的时间戳

 @param timeStr <#timeStr description#>
 @return <#return value description#>
 */
- (NSTimeInterval)getTimeIntervalWihtTimeStr:(NSString *)timeStr
{
    NSDate *dd = [[LZDateFormatterManager shareInstance] dateFromCustomFormat:@"dd-MM-yyyy HH:mm:ss" andDate:timeStr];
    
    NSTimeInterval timeTemp = [dd timeIntervalSince1970]*1000;
    
    return timeTemp;
}


/**
 根据时间戳返回时间字符串

 @param timeInterval 时间戳
 @return 时间字符串
 */
- (NSString *)getTimeStrWithTimeInterval:(NSTimeInterval)timeInterval
{
    return [[LZDateFormatterManager shareInstance] stringFromDoubleTimestampHaveLineyyyyMMdd:timeInterval];
}


#pragma mark -
#pragma mark 初始化 UI
- (void)initUI
{
    [self addSubview:self.collectionViewBGView];
    [self.collectionViewBGView addSubview:self.collectionView];
    [self.collectionViewBGView addSubview:self.confirmBtn];
    [self addSubview:self.datePickerBgView];
    [self.datePickerBgView addSubview:self.pickerCancelBtn];
    [self.datePickerBgView addSubview:self.pickerConfirmBtn];
    [self.datePickerBgView addSubview:self.datePicker];
    
    [self setMasonry];
    
    
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction)];
    tap.delegate = self;
    [self addGestureRecognizer:tap];
    
    UISwipeGestureRecognizer *swipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeAction)];
    swipe.delegate = self;
    [self addGestureRecognizer:swipe];
    
    [self.collectionView reloadData];
}

/**
 设置空间约束
 */
- (void)setMasonry
{
    [self.collectionViewBGView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(SCREEN_WIDTH);
        make.width.mas_equalTo(self.collectionViewWith);
        make.top.mas_equalTo(0);
        make.bottom.mas_equalTo(0);
    }];
    [self.collectionView makeConstraints:^(MASConstraintMaker *make) {
        make.leading.and.trailing.equalTo(0);
        make.top.equalTo(20);
        make.bottom.equalTo(-46.5);
    }];
    
    [self.confirmBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(self.collectionView);
        make.trailing.equalTo(self.collectionView);
        make.bottom.mas_equalTo(0);
        make.height.mas_equalTo(46.5);
    }];
    
    [self.datePickerBgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(0);
        make.trailing.mas_equalTo(0);
        make.bottom.mas_equalTo(datePickerBgViewHeight);
        make.height.mas_equalTo(datePickerBgViewHeight);
    }];
    
    [self.datePicker mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(0);
        make.trailing.mas_equalTo(0);
        make.bottom.mas_equalTo(0);
        make.height.mas_equalTo(datePickerHeight);
    }];
    
    [self.pickerCancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(0);
        make.top.mas_equalTo(0);
        make.size.mas_equalTo(CGSizeMake(100, 30));
    }];
    
    [self.pickerConfirmBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.trailing.mas_equalTo(0);
        make.top.mas_equalTo(0);
        make.size.mas_equalTo(CGSizeMake(100, 30));
    }];
}



#pragma mark -
#pragma mark 初始化
- (UICollectionView *)collectionView
{
    if (!_collectionView) {
        LZRestaurantFilterFlowLayout *layout = [[LZRestaurantFilterFlowLayout alloc] init];
        _collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
        _collectionView.alwaysBounceVertical = YES;
        _collectionView.dataSource = self;
        _collectionView.delegate = self;
        _collectionView.backgroundColor = [UIColor whiteColor];
        
        [_collectionView registerNib:[UINib nibWithNibName:@"LZRestaurantFilterHeaderView" bundle:nil] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:headerStr];
        [_collectionView registerNib:[UINib nibWithNibName:@"LZRestaurantFilterFooterView" bundle:nil] forSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:footerStr];
        [_collectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:@"foot"];
        [_collectionView registerNib:[UINib nibWithNibName:@"LZRestaurantFilterCell" bundle:nil] forCellWithReuseIdentifier:cellNormalStr];
        [_collectionView registerNib:[UINib nibWithNibName:@"LZRestaurantFiltersTextFiledCell" bundle:nil] forCellWithReuseIdentifier:cellTextFiledStr];
    }
    
    return _collectionView;
}

- (UIView *)collectionViewBGView {
    if (!_collectionViewBGView) {
        _collectionViewBGView = [[UIView alloc] init];
        _collectionViewBGView.backgroundColor = [UIColor whiteColor];
    }
    return _collectionViewBGView;
}

- (UIDatePicker *)datePicker
{
    if (!_datePicker) {
        _datePicker = [[UIDatePicker alloc] init];
        
        if ([LZLanguageManager shareInstance].getLanguageType == LanguageType_Ar) {
            [_datePicker setLocale:[[NSLocale alloc]initWithLocaleIdentifier:@"ar"]];
        }
        else {
            [_datePicker setLocale:[[NSLocale alloc]initWithLocaleIdentifier:@"en_GB"]];
        }
        
        [_datePicker setTimeZone:[NSTimeZone localTimeZone]];
        [_datePicker setDate:[NSDate date] animated:YES];
        [_datePicker setMaximumDate:[NSDate date]];
        [_datePicker setDatePickerMode:UIDatePickerModeDate];
        [_datePicker addTarget:self action:@selector(datePickerValueChangeAction) forControlEvents:UIControlEventValueChanged];
    }
    
    return _datePicker;
}

- (UIView *)datePickerBgView
{
    if (!_datePickerBgView) {
        _datePickerBgView = [[UIView alloc] init];
        _datePickerBgView.backgroundColor = [UIColor whiteColor];
    }
    
    return _datePickerBgView;
}

- (UIButton *)pickerCancelBtn
{
    if (!_pickerCancelBtn) {
        _pickerCancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _pickerCancelBtn.backgroundColor = [UIColor clearColor];
        [_pickerCancelBtn setTitle:LZLocalizedString(@"cancel", nil) forState:UIControlStateNormal];
        [_pickerCancelBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [_pickerCancelBtn addTarget:self action:@selector(cancelPickerBtnAction) forControlEvents:UIControlEventTouchUpInside];
    }
    
    return _pickerCancelBtn;
}

- (UIButton *)pickerConfirmBtn
{
    if (!_pickerConfirmBtn) {
        _pickerConfirmBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _pickerConfirmBtn.backgroundColor = [UIColor clearColor];
        [_pickerConfirmBtn setTitle:LZLocalizedString(@"confirm", nil) forState:UIControlStateNormal];
        [_pickerConfirmBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [_pickerConfirmBtn addTarget:self action:@selector(confirmPickerBtnAction) forControlEvents:UIControlEventTouchUpInside];
    }
    
    return _pickerConfirmBtn;
}

- (UIButton *)confirmBtn
{
    if (!_confirmBtn) {
        _confirmBtn = [UIButton buttonWithType: UIButtonTypeCustom];
        _confirmBtn.backgroundColor = UIColorFromRGB(0xff7a21, 1);
        _confirmBtn.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:12];
        [_confirmBtn setTitle:LZLocalizedString(@"confirm", nil) forState:UIControlStateNormal];
        [_confirmBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [_confirmBtn addTarget:self action:@selector(confirmBtnAction) forControlEvents:UIControlEventTouchUpInside];
    }
    
    return _confirmBtn;
}


- (NSArray *)sectionTitleArr
{
    if (!_sectionTitleArr) {
        if (_isForRestaurant) {
            _sectionTitleArr = [LZFilterViewPresenter returnSectionNameForRestaurant];
        }else{
           _sectionTitleArr = [LZFilterViewPresenter returnSectionNameForVideo];
        }
    }
    
    return _sectionTitleArr;
}

- (NSMutableArray *)sortDataArr
{
    if (!_sortDataArr) {
        if (_isForRestaurant) {
            _sortDataArr = [LZFilterViewPresenter returnSortArrForRestaurant];
        }else{
            _sortDataArr = [LZFilterViewPresenter returnSortArrForVideo];
        }
    }
    
    return _sortDataArr;
}

- (NSMutableArray *)othersDataArr
{
    if (!_othersDataArr) {
        _othersDataArr = [LZFilterViewPresenter returnOtherArr];
    }
    return _othersDataArr;
}

- (NSMutableArray *)distanceDataArr
{
    if (!_distanceDataArr) {
        _distanceDataArr = [LZFilterViewPresenter returnDistanceArr];
    }
    return _distanceDataArr;
}

- (NSMutableArray *)discountsDataArr
{
    if (!_discountsDataArr) {
        _discountsDataArr = [LZFilterViewPresenter returnDiscountsArr];
    }
    return _discountsDataArr;
}
- (NSMutableArray *)cuisineSelectedArr
{
    if (!_cuisineSelectedArr) {
        _cuisineSelectedArr = [[NSMutableArray alloc] init];
    }
    return _cuisineSelectedArr;
}

- (NSMutableArray *)discountsSelectedArr
{
    if (!_discountsSelectedArr) {
        _discountsSelectedArr = [[NSMutableArray alloc] init];
    }
    
    return _discountsSelectedArr;
}


- (NSMutableArray *)hotAreasSelectedArr
{
    if (!_hotAreasSelectedArr) {
        _hotAreasSelectedArr = [[NSMutableArray alloc] init];
    }
    return _hotAreasSelectedArr;
}

- (NSMutableDictionary *)historyDic
{
    if (!_historyDic) {
        _historyDic = [[NSMutableDictionary alloc] init];
    }
    
    return _historyDic;
}

@end
